<template>
  <h2>依赖注入的改写</h2>
  <Child />
</template>

<!-- <script setup>
import Child from "./components/10-child.vue";
// provide函数用来做依赖
import { provide, ref, onMounted } from "vue";

const count = ref(10);

onMounted(() => {
  setTimeout(() => {
    count.value++;
  }, 1000);
});

provide("count", count);
</script> -->

<script>
import Child from "./components/10-child.vue";
import { provide, ref } from "vue";

export default {
  components: {
    Child,
  },
  setup() {
    const count = ref(10);
    provide("count", count);
  },
};
</script>
